home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Converters / aa_m68k_Intel_HP_Only / ToMPEG.0.8 / Source / ToMPEG.nib / data.nib (.txt) < prev   
Encoding:
NeXT TypedStream Data  |  1994-11-04  |  13.1 KB  |  287 lines

  1. typedstream
  2. IBObjectData
  3. Object
  4. CustomObject
  5. Application
  6.     Responder
  7. ClipView
  8. ScrollView
  9. Scroller
  10. Control
  11. _doScroller:
  12. @@@ffs
  13. NXCursor
  14. NXImage
  15. NXibeam
  16. ciifffcfffs
  17. [7528c]{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
  18. \margl40
  19. \margr40
  20. {\colortbl;\red0\green0\blue0;}
  21. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b\i0\ulnone\fs24\fc0\cf0 TIFF ANIMATION SEQUENCE --> MPEG video file
  22. \b0 \
  23. This program reads a sequence of files representing N frames in an animation sequence, translates each to PPM format, and then compresses the resulting sequence into a single MPEG movie file, using the "mpeg-encode" program available from \
  24. \pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\fc1\cf1 ftp://s2k-ftp.cs.berkeley.edu/pub/multimedia/mpeg/mpeg_encode-1.3.tar.Z\
  25. \fc0\cf0 \
  26. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0 The "defaults" button assumes that the animation is in a NeXT-style "anim" bundle, for example "~/Library/Images/Movies/Globe.anim", holding 24-bit RGB TIFF files, possibly compressed by NeXT's LZW or JPEG algorithms, and in this example named "Globe.framenumber.tiff" where framenumber takes all integer values from 1 to 72 inclusive.\
  27. \b The prefixnames of all frame files in the animation directory must be identical to each other, and to the prefixname of the directory.  The .anim extension of the directoryname may be omitted, but the extension of each frame file must be .framenumber, followed by lowercase .tiff.
  28. \b0 \
  29. The TIFF frame format may be replaced by PPM or YUV, as well as GIF or any of the formats supported by Poskanzer's public domain pbmplus package.  Any format 
  30. \b NOT TIFF, PPM, YUV, or SPECIAL
  31. \b0  requires that you specify the search path to the pbmplus executable. Frame formats 
  32. \b RAW and YUV contain no header information, 
  33. \b0 and thus require that you provide the frame width and height, in that order, separated by "x" or "X".  Frame format 
  34. \b RGB3
  35. \b0  requires three PGM files for each frame, with extensions 
  36. \b .framenumber
  37. \b0  followed by 
  38. \b .r
  39. \b0 , 
  40. \b .g
  41. \b0 , or 
  42. \b .b
  43. \b0 , indicating red, green, or blue.  All other formats must follow the same naming convention as the NeXT "anim" format, i.e. "Name.*.type", where \
  44.     Name    =     name of the animation directory, \
  45.     *      =    integer framenumber, \
  46.     type     =     lowercase Frame Format (tiff, gif, yuv, etc)\
  47. except for RGB3, as noted above.\
  48. If your frames aren't in any of the supported formats, you may either translate them yourself, or you may choose SPECIAL from the PopUpList, type in your own chosen extension, for example "MyType", and copy an executable translator named "MyType2ppm" into toMPEG.app, using the same case as the filename extension.  Your translator must take a single frame filename as input on the commandline, and output a ppm copy of that frame to stdout.  To help with that, here's the Objective-C source for the tiff2ppm executable:\
  49. \pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\fc0\cf0 // tiff2ppm.m: Translate a TIFF file to PPM format\
  50. // Usage: tiff2ppm tifffile  > ppmfile\
  51. // Compile with: \
  52. //   cc -O -g tiff2ppm.m -o tiff2ppm -lsys_s -lNeXT_s -arch m68k -arch i386\
  53. // Written by cahalan@clouds.gsfc.nasa.gov, October, 1994.\
  54. #include <stdio.h>\
  55. #import <dpsclient/event.h>\
  56. #import <appkit/appkit.h>\
  57. #define maxVal 255 \
  58. #define HI    240  // upper 4 bits\
  59. #define LO    15   // lower 4 bits\
  60.     struct Color \{unsigned char *R; unsigned char *G; unsigned char *B;\
  61.                 unsigned char *A;\};\
  62.     struct Color *pColor;\
  63.     BOOL isPlanar = FALSE, hasAlpha = FALSE;\
  64.     int width, height, samples = 3, bitsPerSample = 8, numColors = 3;\
  65.     unsigned char r, g, b;\
  66. void die(char *s) \{fprintf(stderr,"%s\\n",s);exit(1);\}\
  67. void writePPM(void)\
  68.     \{\
  69.     register int x, y, i;\
  70.     fprintf(stdout, "P6\\n");\
  71.     fprintf(stdout, "%d %d\\n", width, height);\
  72.     fprintf(stdout, "%d\\n", maxVal);\
  73. //   ********************* grayscale with "min-is-white"\
  74.     if (samples==1 && bitsPerSample == 8) \{\
  75.         for (y=0; y<height; y++) for (x=0; x<width; x++)  \{\
  76.             r = *pColor->R++ ^ maxVal; \
  77.             for (i=0; i<3; i++) putchar(r);\
  78.         \}\
  79.     return;\
  80. //   ********************* increment Color ptr for planar or non-planar\
  81.         switch(bitsPerSample) \{\
  82.             case 1: \
  83.             case 2: die("Can't do monochrome!\\n");\
  84.                 break;\
  85.             case 4: \
  86.                  if(isPlanar) \{samples = samples >> 1;\
  87.                   for (y=0; y<height; y++) for (x=0; x<width/2; x++)  \{\
  88.                 r = *pColor->R; g = *pColor->G; b = *pColor->B;\
  89.                 putchar(r & HI);\
  90.                 putchar(g & HI);\
  91.                 putchar(b & HI);\
  92.                 putchar(r << 4);\
  93.                 putchar(g << 4);\
  94.                 putchar(b << 4);\
  95.                 pColor->R++; pColor->G++; pColor->B++; \
  96.                  \} \}\
  97.                  else if(hasAlpha) \{ samples = samples >> 1;\
  98.                   for (y=0; y<height; y++) for (x=0; x<width; x++)  \{\
  99.                 r = *pColor->R; g = *pColor->G;\
  100.                 putchar(r & HI);\
  101.                 putchar(r << 4);\
  102.                 putchar(g & HI);\
  103.                 pColor->R += samples; \
  104.                 pColor->G += samples; \
  105.                  \} \}\
  106.                  else for (y=0; y<height; y++) for (x=0; x<width/2; x++)  \{\
  107.                 r = *pColor->R; g = *pColor->G; b = *pColor->B;\
  108.                 putchar(r & HI );\
  109.                 putchar(r << 4);\
  110.                 putchar(g & HI);\
  111.                 putchar(g << 4);\
  112.                 putchar(b & HI);\
  113.                 putchar(b << 4);\
  114.                 pColor->R += samples; \
  115.                 pColor->G += samples; \
  116.                 pColor->B += samples;\
  117.                  \}\
  118.                 break;\
  119.             case 8: \
  120.                 for (y=0; y<height; y++) for (x=0; x<width; x++)  \{\
  121.                 fwrite(pColor->R, 1, 1, stdout);\
  122.                 fwrite(pColor->G, 1, 1, stdout);\
  123.                 fwrite(pColor->B, 1, 1, stdout);\
  124.                 if(isPlanar) \{pColor->R++; pColor->G++; pColor->B++;\}\
  125.                 else \{\
  126.                     pColor->R += samples; \
  127.                     pColor->G += samples; \
  128.                     pColor->B += samples;\
  129.                 \}\
  130.                  \}\
  131.                 break;\
  132.             default: die("Don't recognize this TIFF type!\\n");\
  133.                 break;\
  134.         \}\
  135.     \}\
  136. void main(int argc, char *argv[])\
  137.    id tiff;\
  138.    unsigned char *planeData[5] = \{NULL, NULL, NULL, NULL, NULL\};\
  139.    unsigned char *meshedData = NULL;\
  140.    NXSize size;\
  141. /*   ********************* check usage  ****************\
  142.    if(argc > 1) \{\
  143.     fprintf(stderr, "argc = %d\\n", argc);\
  144.     fprintf(stderr, "Translating %s to PPM\\n", argv[1]);\
  145.    \}\
  146.    else die("Usage: tiff2ppm tiffFile > ppmFile");\
  147. //   ********************* read TIFF, load into imageRep *****\
  148.    tiff = [[NXBitmapImageRep alloc] initFromFile:argv[1]];\
  149. //   ********************* get a pointer to the image data *****\
  150.    [tiff getDataPlanes:planeData];\
  151. /*   fprintf(stderr, "planeData[] = \{%ld, %ld, %ld, %ld, %ld\}\\n",\
  152.             planeData[0], planeData[1], planeData[2],\
  153.             planeData[3], planeData[4]);\
  154. //  ********************* get image dimensions, etc\
  155.    [tiff getSize:&size];\
  156.    width = size.width;\
  157.    height = size.height;\
  158.    samples = [tiff samplesPerPixel];\
  159.    bitsPerSample = [tiff bitsPerSample];\
  160.    numColors = [tiff numColors];\
  161.    hasAlpha = [tiff hasAlpha];\
  162. fprintf(stderr, "width = %d\\t height = %d\\n", width, height);\
  163. fprintf(stderr, "samples = %d\\t bitsPerSample = %d\\n", samples, bitsPerSample);\
  164. fprintf(stderr, "numColors = %d\\n hasAlpha = %d\\n", numColors, hasAlpha);\
  165. //   ********************* init Color ptr for planar or non-planar\
  166.    pColor = malloc(sizeof(struct Color));\
  167.    if(isPlanar = [tiff isPlanar]) \{\
  168.        pColor->R = planeData[0];\
  169.     pColor->G = planeData[1];\
  170.     pColor->B = planeData[2];\
  171.    \} else \{\
  172.        meshedData = planeData[0];\
  173.     pColor->R = meshedData;\
  174.     pColor->G = meshedData+1; \
  175.     pColor->B = meshedData+2;\
  176.    \}\
  177. //   ********************* write out the PPM file\
  178.    writePPM();\
  179. //  ********************* cleanup  ****************************\
  180.    [tiff free];\
  181. WindowTemplate
  182. iiii***@s@
  183. Panel
  184. Button
  185. ButtonCell
  186. ActionCell
  187.     Helvetica
  188. cahalan64X86
  189.     TextField
  190. TextFieldCell
  191. toMPEG Conversion Program
  192. Version 0.8
  193. 1by Robert F. Cahalan
  194. cahalan@clouds.gsfc.nasa.gov
  195. MenuTemplate
  196. *@*@ccc
  197. ToMPEG
  198. Matrix
  199. @:@iiii
  200. MenuCell
  201. Info Panel...
  202. Help...
  203. ff@@#::s
  204. submenuAction:
  205. NXmenuArrow
  206. Paste
  207. Select All
  208. [23@]
  209. GOULD
  210. SPECIAL
  211. Conversion Info
  212. Original Animation
  213. FormCell
  214. Directory :
  215. First Frame Number :
  216. Last Frame Number :
  217. Field:
  218. TO MPEG
  219. Helvetica-BoldOblique
  220. NXreturnSign
  221. get defaults
  222. OtherViews
  223.     PopUpListZ
  224. popUp:
  225. NXpopup
  226. NXpopupH
  227. pbmplus Directory:
  228. Frame Format
  229. PEnter animation path, start & end frame nos., and frame format, then hit RETURN.
  230. Window.
  231. bitmapinfo
  232. Bitmaps Directory
  233. VersionNumber
  234. Height
  235. Field2
  236. Width
  237. MainMenu
  238. ScrollingText
  239. ToMPEGInstance
  240. Field1
  241. MyWindow
  242. Compression
  243. Read Bitmaps
  244. Compression1
  245. File's Owner
  246. get default bitmapinfo
  247. [39@]
  248. IBControlConnector
  249. IBConnector
  250. hide:
  251. terminate:
  252. copy:
  253. paste:
  254. selectAll:
  255. performClick:
  256. makeKeyAndOrderFront:
  257. setDefaults:
  258. toMPEGMethod:
  259. IBOutletConnector
  260. animinfo
  261. delegate
  262. doTIFF:
  263. doGIF:
  264. doGOULD:
  265. doILBM:
  266. doIMG:
  267. doMTV:
  268. doPCX:
  269. doPGM:
  270. doPI1:
  271. doPICT:
  272. doPJ:
  273. doQRT:
  274. doRAW:
  275. doRGB3:
  276. doSLD:
  277. doSPC:
  278. doSPU:
  279. doTGA:
  280. doXIM:
  281. doXPM:
  282. doYUV:
  283. doPPM:
  284. formatButton
  285. converterinfo
  286. doSPECIAL:
  287.